﻿using JESAI.Redis.Builders;
using JESAI.Redis.Enums;
using System;
using System.Collections.Generic;
using System.Text;

namespace JESAI.Redis.Abstracts
{
    public interface IConnectionBuilder
    {
        /// <summary>
        /// redis数据库索引
        /// </summary>
        public int DBIndex { get; set; }

        /// <summary>
        /// 主节点名称 用于哨兵
        /// </summary>
        public string MasterName { get; set; }

        /// <summary>
        /// redis服务集群类型
        /// </summary>
        public ServerType ServerType { get; set; }

        /// <summary>
        /// 解析连接字符串
        /// </summary>
        /// <param name="connectionString"></param>
        /// <returns></returns>
        public ConnectionBuilder ParseConnsction(string connectionString);

        /// <summary>
        /// redis连接池最大连接数
        /// </summary>
        public int MaxPoolSize { get; set; }

        /// <summary>
        /// redis连接池连接数
        /// </summary>
        public int PoolSize { get; set; }

        /// <summary>
        /// 尝试获取次数
        /// </summary>
        public int TryGetRetryCount { get; set; }

        /// <summary>
        /// 空闲连接回收时间
        /// </summary>
        public TimeSpan IdleTime { get; set; }

        /// <summary>
        /// 连接地址
        /// </summary>
        public string[] ConnectionStringArray { get; set; }

        /// <summary>
        /// 超时时间 ms 默认3000
        /// </summary>
        public int TimeOut { get; set; }

        /// <summary>
        /// 是否启用RESP3
        /// </summary>
        public bool RESP3 { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// 密码
        /// </summary>
        public string Password { get; set; }
    }
}
